﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace vmlModel.Entities
{
    public enum wPictType { group, shape, arc, curve, line, polyline, rect, roundrect, oval}
    public class wPict : vmlObject
    {
        public OoxmlDoc ParentDoc { get; set; }
        public vmlShapeType iVmlShapeType { get; set; }
        public vmlGroup iVmlGroup { get; set; }
        public wPictType iwPictType { get; set; }

        public wPict()
        {

        }
        public wPict(OoxmlDoc _parentDoc, XElement _vmlObjElement)
        : base(_vmlObjElement)
        {
            ParentDoc = _parentDoc;
            //global::System.Windows.Forms.MessageBox.Show(vmlObjXml);
            FillMe();
        }

        private void FillMe()
        {
            // get the picts
            foreach (XElement element in from elemnt in vmlObjElement.Elements()
                                         select elemnt)
            {
                switch (element.Name.LocalName.ToLower())
                {
                    case "shapetype":
                        ParentDoc.vmlShapeTypes.Add(new vmlShapeType(element));
                        break;
                    case "group":
                        ParentDoc.vmlGroups.Add(new vmlGroup(element));
                        break;
                    case "shape":
                        ParentDoc.vmlChildernShapes.Add(new vmlShape(element));
                        break;
                    case "arc":
                        ParentDoc.vmlChildernShapes.Add(new vmlArc(element));
                        break;
                    case "curve":
                        ParentDoc.vmlChildernShapes.Add(new vmlCurve(element));
                        break;
                    case "line":
                        ParentDoc.vmlChildernShapes.Add(new vmlLine(element));
                        break;
                    case "polyline":
                        ParentDoc.vmlChildernShapes.Add(new vmlPolyline(element));
                        break;
                    case "rect":
                        ParentDoc.vmlChildernShapes.Add(new vmlRect(element));
                        break;
                    case "roundrect":
                        ParentDoc.vmlChildernShapes.Add(new vmlRoundrect(element));
                        break;
                    case "oval":
                        ParentDoc.vmlChildernShapes.Add(new vmlOval(element));
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
